home *** CD-ROM | disk | FTP | other *** search
/ Over 1,000 Windows 95 Programs / Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso / 1271 / easyline.bas < prev    next >
Encoding:
BASIC Source File  |  1997-03-14  |  1.8 KB  |  84 lines

  1. ' SIMPLINE.BAS
  2.  
  3. Option Explicit
  4.  
  5. Dim FatalFlag As Integer
  6. Dim Code As Integer
  7.  
  8. Sub Aborting ()
  9.   Dim Code As Integer
  10.   EASY.Print "Fatal Error, Aborting..."
  11.   Code = SioDone(ThePort)
  12.   End
  13. End Sub
  14.  
  15. Sub GetIncoming ()
  16.   Dim i As Integer
  17.   Dim Buffer As String * 1024
  18.   Dim Count As Integer
  19.   Count = SioGets(ThePort, Buffer, 1024)
  20.   If Count > 0 Then
  21.     For i = 1 To Count
  22.       Call DisplayChar(EASY, Asc(Mid$(Buffer, i, 1)))
  23.     Next i
  24.   End If
  25. End Sub
  26.  
  27. Sub GoOffLine ()
  28.   Dim Code As Integer
  29.   OnLineFlag = 0
  30.   'shut down port
  31.   Code = SioDone(ThePort)
  32. End Sub
  33.  
  34. Sub GoOnLine ()
  35.   Dim i As Integer
  36.   Dim RxQueSize As Integer
  37.   Dim TxQueSize As Integer
  38.   If OnLineFlag Then
  39.     Exit Sub
  40.   End If
  41.   'reset the port (1024 byte RX buffer & 256 byte TX buffer)
  42.   RxQueSize = 1024
  43.   TxQueSize = 256
  44.   Code = SioReset(ThePort, RxQueSize, TxQueSize)
  45.   If Code < 0 Then
  46.     Call SayError(EASY, Code)
  47.     Exit Sub
  48.   End If
  49.   'set baud rate
  50.   Code = SioBaud(ThePort, TheBaudCode)
  51.   'call Aborting() if detect error after resetting port
  52.   Call DisplayLine(EASY, "COM" + LTrim$(Str$(1 + ThePort)) + " reset")
  53.   'set DTR & RTS
  54.   Code = SioDTR(ThePort, Asc("S"))
  55.   Code = SioRTS(ThePort, Asc("S"))
  56.   'turn on hardware flow control
  57.   '''Code = SioFlow(ThePort, Asc("H"))
  58.   ' set parms
  59.   Code = SioParms(ThePort, NoParity, OneStopBit, WordLength8)
  60.   ' we're online !
  61.   OnLineFlag = 1
  62. End Sub
  63.  
  64. Sub SetBaud ()
  65. Dim Code As Integer
  66. 'Baudrate can be changed while running
  67. Code = SioBaud(ThePort, TheBaudCode)
  68. End Sub
  69.  
  70. Sub ShowConfig ()
  71.   Dim A As String
  72.   Dim B As String
  73.   Dim C As String
  74.   If OnLineFlag Then
  75.     A = " (Online)"
  76.   Else
  77.     A = " (Offline)"
  78.   End If
  79.   B = "COM" + LTrim$(Str$(ThePort + 1))
  80.   C = " @ " + BaudRateTable(TheBaudCode) + " "
  81.   EASY.Caption = "EASY: " + B + C + A
  82. End Sub
  83.  
  84.